import request from '../util/request'

// 抓药师查询药品列表
export function getMedicalManage (data) {
  return request({
    url: '/hospital-system/medicine/get',
    method: 'post',
    data: {
      currentPage: data.currentPage,
      pageSize: data.pageSize,
      hospitalUuid: data.hospitalUuid,
      name: data.name,
      type: data.type,
      isOTC: data.isOTC,
      isSell: data.isSell
    }
  })
}

// 抓药师新增药品
export function addMedicalManage (data) {
  return request({
    url: '/hospital-system/medicine/add',
    method: 'post',
    data: {
      hospitalUuid: data.hospitalUuid,
      picture: data.picture,
      pictureName: data.pictureName,
      price: data.price,
      count: data.count,
      unit: data.unit,
      name: data.name,
      type: data.type,
      isOTC: data.isOTC,
      isSell: data.isSell
    }
  })
}

// 抓药师更新药品
export function updateMedicalManage (data) {
  return request({
    url: '/hospital-system/medicine/update',
    method: 'post',
    data: {
      hospitalUuid: data.hospitalUuid,
      medicalUuid: data.medicalUuid,
      picture: data.picture,
      pictureName: data.pictureName,
      price: data.price,
      count: data.count,
      unit: data.unit,
      name: data.name,
      type: data.type,
      isOTC: data.isOTC,
      isSell: data.isSell
    }
  })
}

// 抓药师删除药品
export function deleteMedicalManage (data) {
  return request({
    url: '/hospital-system/medicine/delete',
    method: 'post',
    data: {
      hospitalUuid: data.hospitalUuid,
      medicalUuid: data.medicalUuid
    }
  })
}

// 抓药师根据uuid获取药品
export function getOneMedicalManage (data) {
  return request({
    url: '/hospital-system/medicine/get-one',
    method: 'post',
    data: {
      hospitalUuid: data.hospitalUuid,
      medicalUuid: data.medicalUuid
    }
  })
}

// 抓药师根据uuid入库药品
export function storageMedicalManage (data) {
  return request({
    url: '/hospital-system/medicine/storage',
    method: 'post',
    data: {
      hospitalUuid: data.hospitalUuid,
      medicalUuid: data.medicalUuid,
      count: data.count
    }
  })
}

// 抓药师获取操作日志
export function getMedicalManageHistory (data) {
  return request({
    url: '/hospital-system/medicine/get-history',
    method: 'post',
    data: {
      currentPage: data.currentPage,
      pageSize: data.pageSize,
      hospitalUuid: data.hospitalUuid,
      operateName: data.operateName,
      type: data.type,
      times: data.times
    }
  })
}

// 药品出库
export function sendMedical (data) {
  return request({
    url: '/hospital-system/order/send',
    method: 'post',
    data: {
      orderUuid: data.orderUuid,
      hospitalUuid: data.hospitalUuid,
      expressId: data.expressId,
      expressUuid: data.expressUuid
    }
  })
}

// 获取快递公司
export function expressCompany () {
  return request({
    url: '/hospital-system/order/express-company',
    method: 'get'
  })
}

// 获取快递地址信息
export function getAddress (data) {
  return request({
    url: '/hospital-system/address/get',
    method: 'post',
    data: {
      userUuid: data.userUuid,
      uuid: data.uuid
    }
  })
}

// 获取药方信息
export function getPrescription (data) {
  return request({
    url: '/hospital-system/medicine/show-prescription',
    method: 'post',
    data: {
      hospitalUuid: data.hospitalUuid
    }
  })
}

// 根据药方出库药品
export function outStorage (data) {
  return request({
    url: '/hospital-system/medicine/out-storage',
    method: 'post',
    data: {
      list: data.list,
      prescriptionUuid: data.prescriptionUuid,
      userUuid: data.userUuid,
      hospitalUuid: data.hospitalUuid
    }
  })
}

// 根据用户uuid和订单uuid撤销订单
export function cancelOrder (data) {
  return request({
    url: '/hospital-system/order/cancel',
    method: 'post',
    data: {
      orderUuid: data.orderUuid,
      userUuid: data.userUuid,
      hospitalUuid: data.hospitalUuid,
      msg: data.msg
    }
  })
}

// 完成抓药
export function finish (data) {
  return request({
    url: '/hospital-system/medicine/finish',
    method: 'post',
    data: {
      prescriptionUuid: data.prescriptionUuid
    }
  })
}
